package com.cy;

import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

/**
 * 构建请求参数解析对象，基于此对象的返回值进行授权访问
 */
@Component
public class DefaultRequestOriginParser implements RequestOriginParser {
    @Override
    public String parseOrigin(HttpServletRequest request) {

        //通过请求头来获取请求参数
        /*String origin = request.getHeader("origin");
        return origin;*/

        //获取请求参数
        String value = request.getParameter("origin");
        return value;
    }
}
